package com.hulk.ratel.common.constant.enums;

import com.google.common.base.Objects;
import lombok.AllArgsConstructor;

/**
 * Created by jiangzeng on 2017/5/8.
 */
@AllArgsConstructor
public enum TxnLogStatus {

	/**
	 * 交易成功
	 */
	SUCCESS("01","交易成功"),

	/**
	 * 交易失败
	 */
	FAILED("02","交易失败"),

	/**
	 * 交易已创建
	 */
	CREATED("03","交易已创建"),

	/**
	 * 交易超时
	 */
	TIMEOUT("99","交易超时"),
	
	/**
	 * 处理中
	 */
	PROCESSING("04","处理中"),
	
	
	/**
	 * 订单已取消
	 */
	CANCELED("06","订单已取消"),
	
	/**
	 * 交易已取消
	 */
	REFUNDED("07","订单已退款"),

	/**
	 * 等待支付
	 */
	WAITING("05","等待支付");

	

	private String value;
    private String desc;


	public static String explain(String value) {
		for (TxnLogStatus obj : TxnLogStatus.values()) {
			if (Objects.equal(value, obj.value)) {
				return obj.desc;
			}
		}
		return value;
	}
	
	public String getValue() {
		return value;
	}

	public String getDesc() {
		return desc;
	}
	@Override
	public String toString() {
		return this.value;
	}
}
